<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>评论查看</title>
</head>

<body>
    <a href="/home/" class="button">返回</a>
    <h2>评论查看</h2>
    {% if messages %}
    <ul class="messages">
        {% for message in messages %}
        <li {% if message.tags %} class="{{ message.tags }}" {% endif %}>{{ message }}</li>
        {% endfor %}
    </ul>
    {% endif %}
    {% if comments %}
    {% for comment in comments %}
            <li>
                <p><strong>商品ID:</strong> {{ comment.productid }}</p>
                <p><strong>评论:</strong> {{ comment.comment }}</p>
            </li>
        {% endfor %}
    {% else %}
    <p>评论未找到。</p>
    {% endif %}

    <form action="/comment/" method="post">

         {% csrf_token %}
        <button type="submit" name="action" value="1">新增</button>
        <button type="submit" name="action" value="2">删除</button>
        <button type="submit" name="action" value="3">修改</button>
        <button type="submit" name="action" value="4">查询所有信息</button>
        <div class="container mt-5">
            <h1>修改评论信息</h1>
            <form action="/comment/" method="post">
                {% csrf_token %}
                <div class="mb-3">
                    <label for="id_email" class="form-label">商品ID</label>

                    {{ form.productid.errors }}
                    {{ form.productid }}
                </div>
                <div class="mb-3">
                    <label for="id_pname" class="form-label">评论</label>
                    {{ form.comment.errors }}
                    {{ form.comment }}
                </div>
            </form>
        </div>
    </form>
</body>

</html>